package cn.autumnorange.app;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
// 集成redisSession下,测试得出授权服务器需要header传入SESSIONID,SESSION俩个值;
// DefaultSaveRequest()才能获取到本次会话客户端服务器的请求信息 对于客户端的JSESSIONID应该还要传入

/**
 * Created on 2018/4/28.
 *
 * @author zlf
 * @since 1.0
 */
// 解决 CROSSSLOT Keys in request don't hash to the same slot
// https://blog.csdn.net/zl_momomo/article/details/81911705
@SpringBootApplication
@EnableHystrix
@EnableEurekaClient
// @EnableDiscoveryClient
@EnableFeignClients
@EnableRedisHttpSession(
    maxInactiveIntervalInSeconds = 7200,
    redisNamespace = "spring:session{springSessionHashTag}") // RedisHttpSession过期时间(秒)
public class UserConsumerServerApplication {

  public static void main(String[] args) {

    SpringApplication.run(UserConsumerServerApplication.class, args);
  }
  //
  //  @GetMapping("/setsession")
  //  public String setSession(HttpSession session) {
  //    session.setAttribute("test", "wsf");
  //    return session.getAttribute("test").toString() + ", sessionId:" + session.getId();
  //  }
  //
  //  @GetMapping("/getSession")
  //  public String test1(HttpSession session) {
  //    return session.getAttribute("test").toString() + ", sessionId:" + session.getId();
  //  }
}
